package iostream;

import java.io.*;

public class BufferedInputStreamDemo {
    public static void main(String[] args) {
        FileInputStream fs = null;
        try{
            fs = new FileInputStream("E:\\new PC\\study\\java学习\\code\\JavaSE\\基础语法\\src\\iostream\\FileInputStreamDemo.java");
            BufferedInputStream bis = new BufferedInputStream(fs);
            int c = 0;
            System.out.println((char) bis.read());
            System.out.println((char) bis.read());
            bis.mark(1);// 在第2个字节处做一个标记
            for (int i = 0; i <= 10 && (c = bis.read()) != -1; i++) {
                System.out.print((char) c);
            }
            System.out.println();
            bis.reset();// 重新回到原来标记的地方
            for (int i = 0; i <= 10 && (c = bis.read()) != -1; i++)
            {
                System.out.print((char) c);
            }
            bis.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
